<template>
<h1>EL-菜单组件</h1>
<!--  默认垂直方向，horizontal横向分布-->
  <el-menu mode="horizontal"
           @select="handleSelect"
           background-color="lightskyblue"
  text-color="purple"
           active-text-color="yellow"
           default-active="2">
    <el-menu-item index="1">首页</el-menu-item>
    <el-menu-item index="2">直播课</el-menu-item>
    <el-menu-item index="3">线上课</el-menu-item>
    <el-menu-item index="4">脱产课</el-menu-item>
    <el-menu-item index="5">实训课</el-menu-item>
    <el-sub-menu index="6">
      <template #title>联系我们</template>
      <el-menu-item index="6-1">QQ</el-menu-item>
      <el-menu-item index="6-2">微信</el-menu-item>
      <el-menu-item index="6-3">抖音</el-menu-item>
    </el-sub-menu>
  </el-menu>
</template>

<script setup>
//index指的是用户选择的是那个菜单项，对应菜单项index的值，比如5表示选择了“实训课”
// indexPath指的是如何到达当前这个菜单项，比如[“6”,”6-3”]表示从“联系我们”菜单项进入到“抖音”菜单项
const handleSelect = (index,indexPath)=>{
  console.log(index,indexPath)
}
</script>

<style scoped>

</style>